package com.jxm.hutools;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.HexUtil;
import org.junit.Test;

/**
 * @Author: jxm
 * @Description:
 * @Date: 2023-12-18 15:50
 * @Version: 1.0
 */
public class HexUtilTest {

    @Test
    public void test1(){
        String str = "我是一个字符串";

        String hex = HexUtil.encodeHexStr(str, CharsetUtil.CHARSET_UTF_8);

        //hex是：
        //e68891e698afe4b880e4b8aae5ad97e7aca6e4b8b2

        String decodedStr = HexUtil.decodeHexStr(hex);

        System.out.println(decodedStr);
    }
}
